"""
URL configuration for mySite project.

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/5.1/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path,re_path,include
from django.shortcuts import HttpResponse
import datetime
import view
from app01 import view as app01_view


#视图函数
def get_timer(r):
    print(r) #请求的信息对象
    t = datetime.datetime.now()
    return HttpResponse(t)


urlpatterns = [

    path('admin/', admin.site.urls),
    #添加一个路由
    path('timer/', get_timer),
    #分路由从别的文件导入
    path('timer2/', view.get_timer2),
    #app应用
    path('art/', app01_view.get_app01),
    # #正则路由 匹配4个数字 路径参数也就是
    # re_path('art/(\d{4})', app01_view.get_app01_2),
    #有名正则分组
    re_path('^art/(?P<n>\d+)/(?P<y>\d+)/$', app01_view.get_app01_3),
    # 路由解耦分发
    path('app02/', include('app02.urls')),
]
